package com.census.entity;

import javax.persistence.*;
import java.sql.Date;

/**
 * Created by WangKai's Hands.
 * User:WangKai
 * Date:2017/6/30
 * Time:2:35
 * Email: 1786025737@qq.com
 */
@Entity
@IdClass(PersonalinfoPK.class)
public class Personalinfo {
    private int userId;
    private String cardId;
    private String name;
    private String sex;
    private String nation;
    private Date birthday;
    private String bloodType;
    private String usedName;
    private String relation;
    private double height;
    private String degiee;
    private int addressId;
    private String mairage;
    private String nativePlace;
    private String job;
    private String faith;
    private String photo;
    private String politices;

    @Id
    @Column(name = "user_id")
    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    @Id
    @Column(name = "card_id")
    public String getCardId() {
        return cardId;
    }

    public void setCardId(String cardId) {
        this.cardId = cardId;
    }

    @Basic
    @Column(name = "name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "sex")
    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    @Basic
    @Column(name = "nation")
    public String getNation() {
        return nation;
    }

    public void setNation(String nation) {
        this.nation = nation;
    }

    @Basic
    @Column(name = "birthday")
    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    @Basic
    @Column(name = "blood_type")
    public String getBloodType() {
        return bloodType;
    }

    public void setBloodType(String bloodType) {
        this.bloodType = bloodType;
    }

    @Basic
    @Column(name = "used_name")
    public String getUsedName() {
        return usedName;
    }

    public void setUsedName(String usedName) {
        this.usedName = usedName;
    }

    @Basic
    @Column(name = "relation")
    public String getRelation() {
        return relation;
    }

    public void setRelation(String relation) {
        this.relation = relation;
    }

    @Basic
    @Column(name = "height")
    public double getHeight() {
        return height;
    }

    public void setHeight(double height) {
        this.height = height;
    }

    @Basic
    @Column(name = "degiee")
    public String getDegiee() {
        return degiee;
    }

    public void setDegiee(String degiee) {
        this.degiee = degiee;
    }

    @Basic
    @Column(name = "address_id")
    public int getAddressId() {
        return addressId;
    }

    public void setAddressId(int addressId) {
        this.addressId = addressId;
    }

    @Basic
    @Column(name = "mairage")
    public String getMairage() {
        return mairage;
    }

    public void setMairage(String mairage) {
        this.mairage = mairage;
    }

    @Basic
    @Column(name = "native_place")
    public String getNativePlace() {
        return nativePlace;
    }

    public void setNativePlace(String nativePlace) {
        this.nativePlace = nativePlace;
    }

    @Basic
    @Column(name = "job")
    public String getJob() {
        return job;
    }

    public void setJob(String job) {
        this.job = job;
    }

    @Basic
    @Column(name = "faith")
    public String getFaith() {
        return faith;
    }

    public void setFaith(String faith) {
        this.faith = faith;
    }

    @Basic
    @Column(name = "photo")
    public String getPhoto() {
        return photo;
    }

    public void setPhoto(String photo) {
        this.photo = photo;
    }

    @Basic
    @Column(name = "politices")
    public String getPolitices() {
        return politices;
    }

    public void setPolitices(String politices) {
        this.politices = politices;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Personalinfo that = (Personalinfo) o;

        if (userId != that.userId) return false;
        if (Double.compare(that.height, height) != 0) return false;
        if (addressId != that.addressId) return false;
        if (cardId != null ? !cardId.equals(that.cardId) : that.cardId != null) return false;
        if (name != null ? !name.equals(that.name) : that.name != null) return false;
        if (sex != null ? !sex.equals(that.sex) : that.sex != null) return false;
        if (nation != null ? !nation.equals(that.nation) : that.nation != null) return false;
        if (birthday != null ? !birthday.equals(that.birthday) : that.birthday != null) return false;
        if (bloodType != null ? !bloodType.equals(that.bloodType) : that.bloodType != null) return false;
        if (usedName != null ? !usedName.equals(that.usedName) : that.usedName != null) return false;
        if (relation != null ? !relation.equals(that.relation) : that.relation != null) return false;
        if (degiee != null ? !degiee.equals(that.degiee) : that.degiee != null) return false;
        if (mairage != null ? !mairage.equals(that.mairage) : that.mairage != null) return false;
        if (nativePlace != null ? !nativePlace.equals(that.nativePlace) : that.nativePlace != null) return false;
        if (job != null ? !job.equals(that.job) : that.job != null) return false;
        if (faith != null ? !faith.equals(that.faith) : that.faith != null) return false;
        if (photo != null ? !photo.equals(that.photo) : that.photo != null) return false;
        if (politices != null ? !politices.equals(that.politices) : that.politices != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result;
        long temp;
        result = userId;
        result = 31 * result + (cardId != null ? cardId.hashCode() : 0);
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (sex != null ? sex.hashCode() : 0);
        result = 31 * result + (nation != null ? nation.hashCode() : 0);
        result = 31 * result + (birthday != null ? birthday.hashCode() : 0);
        result = 31 * result + (bloodType != null ? bloodType.hashCode() : 0);
        result = 31 * result + (usedName != null ? usedName.hashCode() : 0);
        result = 31 * result + (relation != null ? relation.hashCode() : 0);
        temp = Double.doubleToLongBits(height);
        result = 31 * result + (int) (temp ^ (temp >>> 32));
        result = 31 * result + (degiee != null ? degiee.hashCode() : 0);
        result = 31 * result + addressId;
        result = 31 * result + (mairage != null ? mairage.hashCode() : 0);
        result = 31 * result + (nativePlace != null ? nativePlace.hashCode() : 0);
        result = 31 * result + (job != null ? job.hashCode() : 0);
        result = 31 * result + (faith != null ? faith.hashCode() : 0);
        result = 31 * result + (photo != null ? photo.hashCode() : 0);
        result = 31 * result + (politices != null ? politices.hashCode() : 0);
        return result;
    }
}
